With regard to video compression encoding, encoding of an MV is generally carried out by encoding a difference between the MV and an MV predictor, thereby reducing a code length assuming that the MV predictor is almost exact. Depending on scenes, however, there occurs a problem that the MV predictor considerably differs from the MV, which results in an increase of the MV code length. In an MPEG (moving picture expert group), encoding of the MV involves calculating a differential vector between the MV and the MV predictor that is determined in accordance with a certain method; and encoding the differential vector. The differential vector can be expressed by scaling a basic differential vector using a scale factor and adding a residual vector to the scaled result. With a scale factor code f_code that determines an encodable range of MV, the scale factor can be expressed as (1<<(f_code−1)). That is, the encodable range of MV is of a size proportional to 2f—code. The basic differential vector is encoded in VLC (variable length coding) while the residual vector is encoded in FLC (fixed length coding). Depending on the f_code, the code length can be varied even for a same differential vector.
The f_code may be determined for every picture. It is possible to employ the minimum f_code value that includes the maximum and minimum values of MV components of a picture.
Moreover, it is also possible to extract the maximum differential value among differential values for MVs of respective macroblocks (MB) in a picture and to employ a minimum f_code value that can express the maximum differential value (see, for example, Japanese Patent Laid-open Application No. 2001-197492).
Further, it is still possible to obtain all MVs of a picture from inputted image processing information, and prevent an excessive increase of MV code length based on the maximum value of the MV components and the correlation value of the MVs (see, for example, Japanese Patent Laid-open Application No. 2002-209216).
In the above methods, however, it is impossible to determine a scale factor until all of the MVs of the picture are detected.
That is, the above-described conventional methods have a problem in that, in encoding a certain picture, an f_code cannot be determined to reduce an MV code length unless all the MVs of the picture are calculated.